﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using wrzy.utll;

namespace wrzy
{
    public sealed class LOG
    {
        public static LOG log = null;
        private static readonly object padlock = new object();
        FileStream afile;
        static StreamWriter sw;
        private LOG()
        {

        }
        public static LOG Instance
        {
            get
            {
                if (log == null)
                {
                    lock (padlock)
                    {
                        if (log == null)
                        {
                            sw = File.AppendText("log_" + General.getDate()+"_"+DateTime.Now.ToString("hh-mm-ss")+".txt"); 
                            log = new LOG();

                        }
                        return log;
                    }
                }

                else
                {

                    return null;

                }
            }
        }
        public static void write(string test)
        {
            
            LOG.sw.WriteLine(DateTime.Now.ToString()+test);
            LOG.sw.Flush();
        }
    }
}
